package cn.yangliu.nacos.management.entity.sys;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Table;

import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * The type of nacos.
 *
 * @author 问道于盲
 * @date 2020 -01-01
 */
@Entity
@Table(name = "cm_role_authority")
@Data
public class Role2Authority {

    /**
     * current class instance's member.
     * The Id.
     */
    @EmbeddedId
    private Role2AuthorityKey id;

    /**
     * The interface Role 2 authority key.
     *
     * @author 问道于盲
     */
    @Embeddable
    @Data
    @NoArgsConstructor
    public static class Role2AuthorityKey implements Serializable {

        /**
         * current class's static member
         * The constant serialVersionUID.
         */
        private static final long serialVersionUID = 6330801478637751653L;

        /**
         * current class instance's member.
         * The Role id.
         */
        @Column(name = "role_id")
        private Long roleId;

        /**
         * current class instance's member.
         * The Authority id.
         */
        @Column(name = "authority_id")
        private Long authorityId;

        /**
         * Instantiates a new Role 2 authority key.
         * allow any class to create a new instance.
         *
         * @param roleId      the role id
         * @param authorityId the authority id
         */
        public Role2AuthorityKey(Long roleId, Long authorityId) {
            this.roleId = roleId;
            this.authorityId = authorityId;
        }
    }
}

